#ifndef SRC_RPC_MODULE_POLL_H
#define SRC_RPC_MODULE_POLL_H

#include "net/poller.h"
#include <poll.h>

namespace net {
class Poll : public Poller {
  public:
    Poll() {
    }
    virtual ~Poll() {
    }

    virtual bool Init();

    bool Add(Event* ev, int flag);
    void Del(Event* ev, int flag);
    bool Mod(Event* ev, int flag);

    void Loop();

  private:
    std::vector<struct pollfd> fds_;
    std::map<int, Event*> events_;

    const static uint32 MaxEventCnt = 1024;

    DISALLOW_COPY_AND_ASSIGN(Poll);
};
}
#endif  // SRC_RPC_MODULE_POLL_H
